<template>
  <div id="nav">
    <top-header>{{headerTitle}}</top-header>
    <search-input :placeholder="placeholder" :maxlength="maxlength"></search-input>
  </div>
  <router-view/>
<tab-bar></tab-bar>
</template>
<script>

import {isReactive,watch} from 'vue'
import TopHeader from '@/components/TopHeader'
import SearchInput from '@/components/SearchInput'
import  {useStore} from 'vuex'
import TabBar from '@/components/TabBar'
import {useRouter} from 'vue-router'
export default {
  components:{
    TopHeader,
    TabBar,
    SearchInput
  },
  setup(){
    const store = useStore()
    console.log(store.state)
    console.log(isReactive(store.state))
    const router = useRouter()
    console.log(router.currentRoute.value)
    watch(
      () => router.currentRoute.value.name,(value) =>{
        // console.log(value)
        store.commit('setHeaderTitle',value)
        store.commit('setPlaceholder',value)
        store.commit('setMaxlength',value)
        store.commit('setField',value)
      }
    )
    return store.state
    }
}
</script>

<style lang="less">

</style>
